<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>操盘软件说明</title>
    <link rel="stylesheet" type="text/css" href="../../css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/own.css"/>
    <script type="text/javascript" src="../../js/mui.min.js" ></script>
    <script type="text/javascript" src="../../js/common.js"></script>
    <script>
      
    	mui.init();  
    	
			var has_ios=false;
			var has_android=false;
			
    	mui.plusReady(function(){
    		
    		//初始化监听头部和底部事件
			tzdr.init.initHearListener();
			//判断手机为安卓或ios
			var hasDown_ios=false;
    		var hasDown_android=false;
			switch (plus.os.name){
				case "Android":
					//判断是否已经安装Android apk true:启动app false:下载app
					has_android=true;
					document.getElementById("ios_set").style.display="none";
					if(judge_android()){
						hasDown_android=true;
						document.getElementById("download").innerHTML="启动快抢手";
					}else{
						hasDown_android=false;
						document.getElementById("download").innerHTML="立即下载安装";
					}
					break;
				case "iOS":
					//判断是否已经安装iOS ipa  true:启动app false:下载app
					has_ios=true;
					hasDown_ios=true; 
					document.getElementById("download").innerHTML="启动快抢手";
					
					break;
				default:
					break;
			}
			
			document.getElementById("toSet").addEventListener("tap",function(){
				if(has_ios){
					mui.openWindow("set.html","set");
				}
			});
			
			document.getElementById("download_img").addEventListener("tap",function(){
			
				if(has_ios){
					if(hasDown_ios){   
						//启动app
						plus.runtime.launchApplication({action:"kuaiqiangshou://"}, function (e) {
							mui.toast("您未安装快抢手软件，请下载安装！");
							hasDown_ios=false;
						    document.getElementById("download").innerHTML="立即下载安装";
						    //plus.webview.currentWebview().reload("true");
						});  
						return;
					}
					if (!hasDown_ios && document.getElementById("download").innerHTML=="立即下载安装"){
						plus.webview.currentWebview().reload("true");
					}
					//打开app stroe 下载 ipa
					
					plus.runtime.openURL("itms-services://?action=download-manifest&amp;url=https://update.vs.com/Future/download/ios_tzdr_app/kqs.plist");  
					return;
				}else if(has_android){
					if(hasDown_android){
						//启动app
						plus.runtime.launchApplication({pname:"com.tts.mtrader.start"
							,extra:{}}, function ( e ) {
								alert( "Open system default browser failed: " + e.message );
						});
						return ;
					}
					//下载 apk  
					plus.runtime.openURL("http://update.vs.com/Future/download/kqs_trader_1.0.apk");
					return;
				}
			});
    	});
    	
    	
    	function judge_android(){
    		var packageName = 'com.tts.mtrader.start';//钱隆的包名
	        var main = plus.android.runtimeMainActivity();
	        var packageManager = main.getPackageManager();
	        var PackageManager = plus.android.importClass(packageManager);
	        var packageInfo = null;
	       try{
	        	packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
	        }catch(e){
	        	mui.toast("未检测到快抢手软件，请点击下载安装！");
	        }
	        if (packageInfo) { 
				//已安装
				return true;
	        } else {
				//未安装
				return false;
	        }
    	}
    	
    	
    	function judge_ios(){
    		var UIApplication = plus.ios.importClass("UIApplication");
			var NSURL = plus.ios.importClass("NSURL");
			
			var app = UIApplication.sharedApplication();  
			var bdScheme = NSURL.URLWithString("qianlong://");
			//install 0:未安装  1：已安装           
			var install = app.canOpenURL(bdScheme);     
			if(install==1){
				return true;
			}else{
				return false;
			}
    	}
    </script>
    

</head>
<body>
	<header class="mui-bar mui-bar-nav own-topbg">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" id="back"><i>返回</i></a>
		<h1 class="mui-title">交易软件说明</h1>		
		<a href="javascript:void(0)" class="top-tel" id="telBtn">客服热线</a>
	</header>
	<!--<nav class="navlist">
		<a href="javascript:void(0);" id="product">
			<span class="mui-icon mui-icon-list"></span>
			<span class="mui-tab-label">产品</span>
		</a>
		<a class="navon" href="javascript:void(0);"  id="scheme">
			<span class="mui-icon mui-icon-compose"></span>
			<span class="mui-tab-label">方案</span>
		</a>
		<a    id="account" href="javascript:void(0);">
			<span class="mui-icon mui-icon-contact mui-icon-icon-contact-filled"></span>
			<span class="mui-tab-label" >账户</span>
		</a>
	</nav>-->
	<div class="mui-content dl_main">
		<div class="mui-content-padded">
			<h4><i>1</i>手机在线操盘，请下载快抢手移动版：</h4>
			<a href="javascript:void(0);" id="download_img"><img src="../../images/dl_01.gif" class="dl_iconimg">
			<i  class="dl_icon" id="download">立即下载安装</i></a>
			<div style="display: block;" id="ios_set" class="ios_set">
				<p style="padding-top: 20px;">A，点击“安装”后，请按Home键到桌面查看安装进度</p>
				<p>B，新用户第一次启动快抢手，会提示“未授信任的企业级开发者”，iOS8及之前版本请选择“信任”，iOS9版请<a href="javascript:void(0);" id="toSet" style="color: #FFCC33;">查看设置方法>></a></p>
			
			</div>
			<h4><i>2</i>PC电脑操盘，请下载快抢手电脑版</h4>
			<img src="../../images/dl_02.gif" class="dl_linkimg">
			<p class="dl_link">请在电脑浏览器中输入网站<a href="javascript:void(0);">dwz.cn/tzdrtts</a></p>
		</div>
	</div>
</body>
</html>